package com.yq.netty.nio;

import java.nio.IntBuffer;

/**
 * @ClassName BaseBuffer
 * @Description buffer的简单使用
 * @Author yaoqiang
 * @Date 2021/3/23 16:00
 * @Version 1.0
 */
public class BaseBuffer {
    public static void main(String[] args) {
        IntBuffer allocate = IntBuffer.allocate(5);
        for (int i=0;i<allocate.capacity();i++){
            allocate.put(i);
        }
        allocate.flip();//读写切换
        while (allocate.hasRemaining()){
            System.out.println(allocate.get());
        }

    }
}
